﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DrugsShopManagement.DBCLASS;
using DevExpress.XtraReports.UI;

namespace DrugsShopManagement
{
    public partial class FrmLock : DevExpress.XtraEditors.XtraForm
    {
       
       
        public  FrmLock(string current_user)
        {
            InitializeComponent();
            u_no = current_user;
        }
        Operator op = new Operator();
        public string u_no;
        
        private void FrmLock_Load(object sender, EventArgs e)
        {
            
            txtBoxUser.Text = u_no;
        }

        private void bt_Untie_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtBoxPWD.Text != "")
                {

                    DataTable dt = new DataTable();
                    dt = op.getDataTable("Select user_pwd from users where user_no='" + txtBoxUser.Text + "'");

                    if (dt.Rows[0][0].ToString() == txtBoxPWD.Text)
                    {
                        this.Visible = false;
                    }
                    else
                    {
                        MessageBox.Show("密码错误！请重新输入！", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        txtBoxPWD.Text = "";
                    }
                }
                else 
                {
                    MessageBox.Show("密码不能为空！", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex) 
            { 
                MessageBox.Show(ex.Message); 
                return;
            }
        }

        
    }
}
